<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #areaDiv{
            width: 200px;
            height: 100px;
            border: 1px solid black;
        }
        #showMsg{
            position: relative;
            margin-top: 10px;
            width: 200px;
            height: 50px;
            border: 1px solid black;
        }
    </style>
</head>
<script>
    window.onload = function () {
        var areaDiv = document.getElementById("areaDiv");
        var showMsg = document.getElementById("showMsg");
        areaDiv.onmousemove = function (event) {
            var x = window.event.clientX;
            var y = window.event.clientY;
            showMsg.innerHTML = "x是"+x+" y是"+y;
        };
    };
</script>
<body>
    <div id="areaDiv"></div>
    <div id="showMsg"></div>
</body>
</html>